function removeMax(s:Array<string>):Array<string>{
  let findMax = false;
  let newString = "";
  for (let i=0;i<s.length+1;i++){
    if(s[i]>s[i+1] && findMax == false){
      findMax = true;
      s.splice(i,1)
    }
  }
  if (findMax == false){
    s.splice(s.length-1,1)
  }
  newString = s.join();
  return s ;
}
//removeMax(['3','1','2'])
function removeKdigits(num: string, k: number): string {
  let str = num.split('')
  for(let i =0; i<k; i++){
    str = removeMax(str)
  }
  
  let s = str.join()
  console.log(s,"----s-----")
  return s
};
removeKdigits("10",2);